#include <cstdint>
#include <iostream>
#include <istream>
using ll = int64_t;
const ll maxn=1e6+7;
ll a[maxn],ans;
int main(){
    ll n;
    std::cin>>n;
    for(ll i=1;i<=n;i++){
        std::cin>>a[i];
    }
    ll l=1,r=n;
    while(l<r){
        if(a[l]<a[r]){
            a[l+1]+=a[l];
            ans++;
            l++;
        }else if(a[l]>a[r]){
            a[r-1]+=a[r];
            ans++;
            r--;
        }else{
            l++,r--;
        }
    }
    std::cout<<ans<<"\n";
}